package com.chris.core.socket.netty.run;

import com.chris.core.socket.netty.dto.SocketTypeEnum;
import com.chris.core.socket.netty.handler.ByteClientHandler;
import com.chris.core.socket.netty.handler.ObjectClientHandler;
import com.chris.core.socket.netty.util.NettyClientUtil;
import com.chris.core.socket.netty.util.NettyRunTimeUtil;
import io.netty.channel.ChannelPipeline;

public class NettyByteClient {
    public static void main(String[] args) throws InterruptedException {

        //NettyRunTimeUtil.runTimeBreakMark="\r\n";
        NettyRunTimeUtil.runTimeBreakMark="";
        NettyClientUtil service = new NettyClientUtil("119.91.204.20",10180,180,NettyRunTimeUtil.runTimeBreakMark,false, SocketTypeEnum.ByteSocket) {
            @Override
            public void AddChannelHandler(ChannelPipeline pipeline) {

                //自定义事件
                pipeline.addLast(new ByteClientHandler());
            }
        };

        service.Open();

        Thread.sleep(6000);
        byte[] bytes = new byte[2];
        bytes[0]=1;
        bytes[1]=2;
        service.sendByteMsg("chirs".getBytes());


        while (true)
        {

        }
    }
}
